<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    li{
      height: 40px;
      width: 400px;
      background-color: #e7c3c3;
      margin-top: 10px;
    }
  </style>
</head>
<body>
  <div id="app">
      <input type="text" v-model="msg">
      {{msg}}

      <input type="number" :min="0" :max="5" v-model.number="rate">
  </div>
  
  <script src="./vue.global.js"></script>
  <script>
    const { createApp } = Vue;
    const app = createApp({
      data(){
        return {
          msg: '你好世界',
          rate: 5
        }
      },
      methods: {
       
      },
      watch: {
        // 侦听基础数据类型
        msg(newVal, oldVal){
          console.log('msg改变了新值是', newVal);
        },
        rate(val){
          if(val == 5) {
            alert('感谢您的5星好评')
          }
          if (val<3) {
            alert('您的评分太低了')
          }
        }
      }
    })
    app.mount('#app')
  </script>
</body>
</html>